<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <div>{{name}}</div>
        <div v-text="name"></div>
        <div v-html="name"></div>
        <counter :count="3" @change="handleSon"></counter>
        <counter :count="2" @change="handleSon"></counter>
        <div>{{total}}</div>
    </div>    
</body>
<script src="https://cdn.bootcss.com/vue/2.5.17-beta.0/vue.js"></script>
<script>
    var counter = {
        props:['count'],
        data(){
            return {
                number :this.count
            }
        },
        template:'<div @click="handleClick">{{number}}</div>',
        methods:{
            handleClick:function(){
                this.number =this.number+2;
                // this.$emit('change');
                this.$emit('change',2);
            }
        }
    }
    var app = new Vue({
        el:"#app",
        data(){
            return {
                name:"<h1>ruijie</h1>",
                total:5
            }
        },
        components:{
            counter:counter
        },
        methods:{
            handleSon(step){
                this.total += step;
            }
        }
    })
</script>
</html>